package com.wiscamp.ninechapters.problems.infrastructure.po.problems;

import com.wiscamp.ninechapters.ddd.PersistenceObject;
import com.wiscamp.ninechapters.problems.enums.Actions;
import jakarta.persistence.*;
import lombok.Data;

import java.io.Serial;

/**
 * 问题答案
 */
@Table(name = "question_answers")
@Data
@Entity
public class QuestionAnswerPO implements PersistenceObject {
    @Serial
    private static final long serialVersionUID = -2916412127059578281L;

    /**
     * 答案编号
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(insertable = false, name = "answer_id", nullable = false)
    private long answerId = 0;

    /**
     * 题编号
     */
    @Column(name = "problem_id", nullable = false)
    private long problemId = 0;

    /**
     * 问题编号
     */
    @Column(name = "question_id", nullable = false)
    private long questionId = 0;

    /**
     * 答案编号内容
     */
    @Column(name = "answer_option_id")
    private long answerOptionId = 0;

    /**
     * 答案超文本内容
     */
    @Column(name = "answer_hypertext")
    private String answerHypertext = "";

    /**
     * 解题方法
     */
    @Column(name = "solution_url")
    private String solutionUrl = "";

    /**
     * 答案序号
     */
    @Column(name = "answer_index", nullable = false)
    private int answerIndex = 0;

    /**
     * 分组序号
     */
    @Column(name = "group_index", nullable = false)
    private int groupIndex = 0;

    /**
     * 答案类型
     */
    @Column(name = "answer_type_id", nullable = false)
    private int answerTypeId = 0;

    /**
     * 问题分数
     */
    @Column(name = "answer_score", nullable = false)
    private double answerScore = 0;

    @Transient
    private Actions action = Actions.NONE;
}